﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using ObjectLibrary;
// -----------------------------------------------------------------------
// <copyright file="$safeitemrootname$.cs" company="$registeredorganization$">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace _0912089_0912172
{
    public class MyCheckBox : FormItem
    {
        private Texture2D _textureCheck;
        private Texture2D _textureUnCheck;
        private bool _isChecked;
        private ContentManager contentManager;
        private GraphicsDevice graphicsDevice;
        private string p;
        private float p_2;
        private Vector3 vector3;
        private Matrix matrix;

        public bool IsChecked
        {
            get { return _isChecked; }
            set {
                _isChecked = value; 
                if(value)
                    ((PlanarModel)_model).Texture = _textureCheck;
                else 
                    ((PlanarModel)_model).Texture = _textureUnCheck;
            }   
        }
        //private bool _prevStateKeySpace;

        public MyCheckBox( string strTexture, float scale, Vector3 pos, float rotationY)
        {
            Texture2D stringTexture = TextureUntity.Create(_content,_graphicsDevice).ExportStringTexture(strTexture);
            _textureCheck = _content.Load<Texture2D>(@"Resources/System/check");
            _textureCheck = TextureUntity.Create(_content, graphicsDevice).horizonMerge( _textureCheck, stringTexture);

            _textureUnCheck = _content.Load<Texture2D>(@"Resources/System/uncheck");
            _textureUnCheck = TextureUntity.Create(_content, graphicsDevice).horizonMerge(_textureUnCheck, stringTexture);
            _model = new PlanarModel(_content, _textureCheck, scale, pos, rotationY);
            
            _size = ((PlanarModel)_model).Size;
            _isChecked = true;
            RotationY = rotationY;
            Position = pos;

        }

    }
}
